#pragma once
#include <iostream>

#include "bstree.h"

void test1()
{
	MyBinSeaTree::BSTree_Key<int,int> bst1;
	
	int arr[] = { 8,6,7,4,5,10,9,12,11,6,7,4,5,10,9,12,11,8,6,7,4,5,10,9,12,11,6,7,4,5,10,9,12,11 };

	int i = 0;
	for (auto au : arr)
	{
		bst1.insert_r(au,i);
		i++;
	}
	
	bst1.PreOrder();
	MyBinSeaTree::Node<int, int>* node1;
	node1 = bst1.PreFind(10);
	std::cout << node1->_key << ':' << node1->_value << std::endl;

	bst1.InOrder();
	MyBinSeaTree::Node<int, int>* node2;
	node2 = bst1.InFind(10);
	std::cout << node2->_key << ':' << node2->_value << std::endl;

	bst1.PostOrder();
	MyBinSeaTree::Node<int, int>* node3;
	node3 = bst1.PostFind(10);
	std::cout << node3->_key << ':' << node3->_value << std::endl;


	MyBinSeaTree::Node<int, int>* node4;
	node4 = bst1.Find(10);
	std::cout << node4->_key << ':' << node4->_value << std::endl;

}

void test2()
{
	MyBinSeaTree::BSTree_Key<int, int> bst1;

	int arr[] = { 8,6,7,4,5,10,9,12,11,4,3,4};

	int i = 0;
	for (auto au : arr)
	{
		bst1.insert_r(au, i);
		i++;
	}

	bst1.PreOrder();

	MyBinSeaTree::BSTree_Key<int, int> bst2(bst1);
	bst2.PreOrder();

	MyBinSeaTree::BSTree_Key<int, int> bst3;
	bst3 = bst1;
	bst3.PreOrder();

}

void test3()
{
	MyBinSeaTree::BSTree_Key<int, int> bst1;

	int arr[] = { 8,6,11,4,20,10,9,12,15,3,7,5,4};

	int i = 0;
	for (auto au : arr)
	{
		bst1.insert_r(au, i);
		i++;
	}

	//bst1.PreOrder();
	bst1.InOrder();
	//bst1.PostOrder();

	bst1.erase(10);
	bst1.erase(12);
	bst1.erase(4);
	bst1.erase(8);

	//bst1.PreOrder();
	bst1.InOrder();
	//bst1.PostOrder();
}
int main()
{
	//test1();
	test2();
	//test3();
	return 0;
}
